package com.trkj.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.trkj.dao.jpa.IInNoticeDao;
import com.trkj.dao.mybatis.LiveinrecordTableMapper;
import com.trkj.pojos.DepositreturnTable;
import com.trkj.pojos.HospWorkInNotice;

@Transactional
@Service
public class HospWorkInNoticeService {
	@Autowired
	private LiveinrecordTableMapper liveinrecordTableMapper;
	@Autowired
	private IInNoticeDao inNoticeDao;
	
	/**
	 * 模糊查询住院通知
	 * @param pname
	 * @return
	 */
	public List<Map<String,Object>> likequeryNoticByNmae(String likeName){
		return liveinrecordTableMapper.findLiveNoticByLikeName(likeName);
	};
	
	
	/**
	 * 保存住院通知
	 * @param hospWorkInNotice
	 */
	public void saveInNotice(HospWorkInNotice hospWorkInNotice){
		inNoticeDao.save(hospWorkInNotice);
	}
	
	public Map<String,Object> loadInNoticeRecord(int page,int rows){
		Page<HospWorkInNotice> p = PageHelper.startPage(page, rows, true);
		List<HospWorkInNotice> list = inNoticeDao.loadInNoticeRecord();
		
		Map<String,Object> resultMap = new HashMap<>();
		resultMap.put("total", p.getTotal());
		resultMap.put("rows", list);
		return resultMap;
	}
}
